package com.seele.tigerwallet.ui.views;

import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.seele.tigerwallet.R;


/**
 * Description: 资产界面的组合控件
 * Data: 2018/6/9 11:02
 * author:  郑波
 */
public class TranslucentLinearLayout extends LinearLayout implements TranslucentScrollView.OnScrollChangedListener {

    private TranslucentScrollView mScrollView;

    private LinearLayout mContainerLinearLayout;

    private RelativeLayout mTitleRelativeLayout;

    private Typeface mTypeface;

    private TextView mAssesTitleTv;
    private TextView mAssesCountTv;


    public TranslucentLinearLayout(Context context) {
        this(context, null);
    }

    public TranslucentLinearLayout(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public TranslucentLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        mTypeface= Typeface.createFromAsset(context.getAssets(), "fonts/CENTURY_GOTHIC_BOLD.TTF");
//        titleTv.setTypeface(font);//设置字

        initView(context);
    }

    private void initView(Context context) {
        View view = View.inflate(context, R.layout.translucent_linear_layout, this);
        mScrollView = view.findViewById(R.id.assets_scrollView);
        mContainerLinearLayout = view.findViewById(R.id.assets_container_ll);
//        mTitleRelativeLayout = view.findViewById(R.id.assets_title_rv);
        mAssesCountTv=view.findViewById(R.id.assets_count_tv);
        mAssesTitleTv = view.findViewById(R.id.assets_title_tv);
        mAssesCountTv.setTypeface(mTypeface);//设置字
        mAssesTitleTv.setTypeface(mTypeface);//设置字
        mScrollView.addOnScrollChangedListener(this);


    }

    @Override
    public void onScrollChanged(int l, int t, int oldl, int oldt) {

    }


    /**
     * 动态添加布局
     *
     * @param view
     */
    public void addItemView(View view) {
        if (null != view) {

            mContainerLinearLayout.addView(view);
        }
    }


}
